"use client"
import React, { useState } from 'react';
import Link from 'next/link';
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import Breadcrumb from '../../../component/mbx'; // 确保路径正确

import {
  BookOutlined,
  UserOutlined,
  VideoCameraOutlined,
  OrderedListOutlined 
} from '@ant-design/icons';
import { Button, Layout, Menu, theme } from 'antd';
import { link } from 'fs';
import { usePathname, useRouter } from 'next/navigation';
const { Header, Sider, Content } = Layout;
const geistSans = Geist({
  variable: "--font-geist-sans",
  subsets: ["latin"],
});

const geistMono = Geist_Mono({
  variable: "--font-geist-mono",
  subsets: ["latin"],
});

const Home = ({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) => {
  const {
    token: { colorBgContainer, borderRadiusLG },
  } = theme.useToken();
  const router = useRouter()
  let pathname=usePathname()
// console.log(pathname);


  const routes=[
    {
      key: '/fff/dingdan/allding',
      label: '全部订单',
    },
    {
      key: '/fff/dingdan/mydingdan',
      label: '我的订单',
    },
    {
      key: '/fff/dingdan/xiashudingdan',
      label: '下属订单',
    },
    {
      key: '/fff/dingdan/woxiezuo',
      label: '我写作的',
    },
    {
      key: '/fff/dingdan/xiashuxiezuo',
      label: '下属协作',
    },
    {
      key: '/fff/dingdan/adddingdan/:obj',
      label: '添加订单',
    }
  ]
  return ( <>
    <div   className={`${geistSans.variable} ${geistMono.variable} antialiased`}>
    <Layout style={{height:"100vh",padding:"0",margin:"0"}}>
      <Sider   style={{background:"#435188",padding:"0",margin:"0"}} collapsed={true}>
        <div className="demo-logo-vertical"/>
        <Menu 
          theme="dark"
          mode="inline"
          style={{background:"#435188"}}
          defaultSelectedKeys={['/fff']}
          onSelect={(i)=>{
              router.push(i.key)
          }}
          items={[
            {
              key: "/fff",
              icon: <OrderedListOutlined /> ,
              label: '订单管理',
            },
            {
              key: "/liyi",
              icon: <UserOutlined />,
              label: '系统管理',
            },
            {
              key: "/lxt",
              icon: <BookOutlined />,
              label: '商机管理',
            },
            {
              key: "/little_jia",
              icon: <UserOutlined />,
              label: '账本管理',
            }
          ]}
        />
      </Sider>

      <Sider width="150px" style={{background:"skyblue"}}>
        <div className="demo-logo-vertical"/>
        订单管理
        <Menu
        style={{background:"skyblue"}}
          theme="dark"
          mode="inline"
          defaultSelectedKeys={[pathname]}
          onSelect={(i)=>{
            router.push(i.key)
        }}
          items={routes}
        />
      </Sider>

      <Layout>
        <Header style={{ padding: 0, background: colorBgContainer }}>
          {/* 顶部 */}
          <Breadcrumb routes={routes}/>
        </Header>
        <Content
          style={{
            margin: '24px 16px',
            padding: 24,
            minHeight: 280,
            background: colorBgContainer,
            borderRadius: borderRadiusLG,
          }}
        >
          {children}
        </Content>
      </Layout>
    </Layout>
      </div>
      </>
  );
};

export default Home;